const {getTOPHttp} = require("../../utils/top-htp")
Page({

   
    data: {
        musics:[],
        offset:0
    },
    onLoad: function (options) {
    var offset = this.data.offset;
    getTOPHttp(offset).then(res=>{
        var musics = res.data.albums;
        this.setData({
            musics
        })
    })
    },
    onReachBottom(){
        console.log("bottom");
        var offset = this.data.offset
        offset+=20;
        getTOPHttp(offset).then(res=>{
            var musics = this.data.musics;
            musics.push(...res.data.albums)
            this.setData({
                musics,
                offset
            })
        })
    }
  
})